package com.chilly.other.collection;

import java.util.TreeSet;

/**
 * @Author cuihaiyan
 * @Create_Time 2020-11-29 09:45
 * @Description:
 */
public class TreeSetTest {
    public static void main(String[] args) {
        Stu jack = new Stu("jack", 25);
        Stu jack2 = new Stu("jack2", 25);
        Stu tom2 = new Stu("tom", 20);
        Stu tom = new Stu("tom", 26);

        TreeSet<Stu> treeSet = new TreeSet<>();
        treeSet.add(jack);
        treeSet.add(jack2);
        treeSet.add(tom2);
        treeSet.add(tom);

        treeSet.forEach(System.out::println);
    }
}
